package geez.widget;

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.Widget;

import static geez.widget.Geez.withStyle;

public class GSpan extends Widget implements GWidget {

    public GSpan(String html) {
        setElement(DOM.createSpan());
        DOM.setInnerText(getElement(), html);
    }

    public GSpan id(String id) {
        Geez.withNameAndId(this, id);
        return this;
    }

    public GSpan css(String cssClass, String... optionalClasses) {
        withStyle(this, cssClass, optionalClasses);
        return this;
    }

    public GWidget show() {
        setVisible(true);
        return this;
    }

    public GWidget hide() {
        setVisible(false);
        return this;
    }

    public GSpan style(String styleAttribute) {
        DOM.setElementAttribute(getElement(), "style", styleAttribute);
        return this;
    }
}
